package org.checkboo.hopefullyengine.text;

import java.util.LinkedList;

public class TextManager {
	
	private static final TextManager INSTANCE = new TextManager();

	private LinkedList<Text> texts;
	
	private TextManager(){
		texts = new LinkedList<Text>();
	}
	
	public static TextManager getInstance(){
		return INSTANCE;
	}
	
	public void addText(Text text){
		this.texts.add(text);
	}
	
	public LinkedList<Text> getTexts(){
		return this.texts;
	}
	
	public Text getTextByName(String name){
		for(Text t : this.texts){
			if(t.getName().equalsIgnoreCase(name))
				return t;
		}
		return null;
	}
	
	public Text getText(int index){
		return this.texts.get(index);
	}
}
